/**
 * author: 何其沆(pooky)
 * desc: Clients Contract - api
 * date: 2021-12-03
 */
import { get, post } from '@/utils/request.js'
import api from '@/config/index.js'

export default {
  /**
   * 创建客户合同
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  createContractInfo(data) {
    return post(api.API_VERSION + '/TargetClients/Contract/CreateContractInfo', data, false)
  },
  /**
   * 客户合同列表查询
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  getContractInfoList(data) {
    return get(api.API_VERSION + '/TargetClients/Contract/GetClientContractInfoList', data, false)
  },
  /**
   * 删除合同
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  deleteContract(data) {
    return get(api.API_VERSION + '/TargetClients/Contract/DeleteContract', data, false)
  },
  /**
   * 判断合同号是否存在
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  contractNumberIsExits(data) {
    return get(api.API_VERSION + '/TargetClients/Contract/ContractNumberIsExits', data, false)
  },
  /**
   * 获取客户单个合同信息
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  getClientContractInfo(data) {
    return get(api.API_VERSION + '/TargetClients/Contract/GetClientContractInfo', data, false)
  },
  /**
   * 编辑客户合同
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  updateContractInfo(data) {
    return post(api.API_VERSION + '/TargetClients/Contract/UpdateContractInfo', data, false)
  },
  /**
   * 创建临时合作申请
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  createContractExceptionInfo(data) {
    return post(api.API_VERSION + '/TargetClients/Contract/CreateContractExceptionInfo', data, false)
  },
  /**
   * 获取临时合作申请
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  getContractExceptionInfo(data) {
    return get(api.API_VERSION + '/TargetClients/Contract/GetContractExceptionInfo', data, false)
  },
  /**
   * 更改临时合作申请
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  updateContractExceptionInfo(data) {
    return post(api.API_VERSION + '/TargetClients/Contract/UpdateContractExceptionInfo', data, false)
  },
  /**
   * 生成合同号
   * @param data
   * @returns {Promise | Promise<unknown>}
   */
  generateContractNumber(data) {
    return post(api.API_VERSION + '/TargetClients/Contract/GenerateContractNumber', data, false)
  },
  /**
   * 获取合同号列表
   * @returns {Promise | Promise<unknown>}
   * @param clientID
   */
  getContractNumberList(clientID) {
    return get(api.API_VERSION + '/TargetClients/Contract/GetContractNumberList', {
      clientID: clientID
    })
  },
  /**
   * 获取长期合作申请审批人
   * @param clientId
   * @returns {Promise | Promise<unknown>}
   */
  getApplyForExtensionAuditors(clientId) {
    return get(api.API_VERSION + '/TargetClients/Contract/GetClientContractExtensionBUMList', { clientID: clientId })
  },
  /**
   * 申请长期合作
   * @param clientId
   * @param bumId
   * @param reason
   * @returns {Promise | Promise<unknown>}
   */
  addApplyForExtension(clientId, bumId, reason) {
    return post(api.API_VERSION + '/TargetClients/Contract/AddClientContractExtension', {
      clientID: clientId,
      reason: reason,
      bumid: bumId
    })
  },
  getExtensionStatus(clientId) {
    return get(api.API_VERSION + '/TargetClients/Contract/GetClientContractExtensionStatus', { clientID: clientId })
  }
}
